﻿using System;
using Messages;
using Rhino.ServiceBus;
using Utils_Rhino;
using Rhino.ServiceBus.Hosting;

namespace Client_Rhino
{
    class Program
    {
        static void Main(string[] args)
        {
            Queues.PrepareQueue("client_rhino");

            var host = new DefaultHost();
            host.Start<BootStrapper>();

            var bus = host.Bus as IServiceBus;

            Console.WriteLine("Write message and hit enter to send it");
            var msg = Console.ReadLine();
            Console.WriteLine("Sending in progress...");

            bus.Send(new Message_Type1
            {
                Text = msg
            });

            Console.ReadLine();
        }
    }

    public class MessageIntercept : ConsumerOf<Message_Type2>
    {
        public void Consume(Message_Type2 message)
        {
            Console.WriteLine(message.Text);
        }
    }
}
